package com.huluspace.authsecurity.controller;

import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ServiceController {
  @GetMapping("/hello")
  public String hello(Authentication auth) {
    System.out.println("Current user: " + auth.getName()); // 观察用户名
    System.out.println("Authorities: " + auth.getAuthorities()); // 观察用户权限
    return "已登录用户访问成功";
  }
}
